package com.example.orderflow.controller;

import java.util.List;

import com.example.orderflow.controller.base.ABaseController;
import com.example.orderflow.entity.query.ApprovalProcessTestQuery;
import com.example.orderflow.entity.po.ApprovalProcessTest;
import com.example.orderflow.entity.vo.ResponseVO;
import com.example.orderflow.service.ApprovalProcessTestService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *  Controller
 */
@RestController("approvalProcessTestController")
@RequestMapping("/approvalProcessTest")
public class ApprovalProcessTestController extends ABaseController {

	@Resource
	private ApprovalProcessTestService approvalProcessTestService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(ApprovalProcessTestQuery query){
		return getSuccessResponseVO(approvalProcessTestService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(ApprovalProcessTest bean) {
		approvalProcessTestService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<ApprovalProcessTest> listBean) {
		approvalProcessTestService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<ApprovalProcessTest> listBean) {
		approvalProcessTestService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getApprovalProcessTestById")
	public ResponseVO getApprovalProcessTestById(Integer id) {
		return getSuccessResponseVO(approvalProcessTestService.getApprovalProcessTestById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateApprovalProcessTestById")
	public ResponseVO updateApprovalProcessTestById(ApprovalProcessTest bean,Integer id) {
		approvalProcessTestService.updateApprovalProcessTestById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteApprovalProcessTestById")
	public ResponseVO deleteApprovalProcessTestById(Integer id) {
		approvalProcessTestService.deleteApprovalProcessTestById(id);
		return getSuccessResponseVO(null);
	}
}